<?php
/**
 * Created by PhpStorm.
 * User: php
 * Date: 2016/8/16
 * Time: 14:41
 */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class DeploymentController extends Controller
{
    public function deploy(Request $request)
    {
        $password = 'huhhz';
        $target = '/var/www/laravel5';
        $json = json_decode($request['hook'], true);
        if (empty($json['password']) || $json['password'] !== $password) {
            exit('error request');
        }
        $cmd = "cd $target && git pull";
        shell_exec($cmd);
    }


}